<template>
	<div class="lm-chatgpt-item">
		<chatgpt-item-header :text="'正在为您生成结果：待办创建'"></chatgpt-item-header>
		<!-- <chatgpt-item-header text="根据历史对话，正在创建待办"></chatgpt-item-header> -->
		<div class="chatgpt-item-content">
			<h-form :model="formItem" ref="form" cols="1" :label-width="65">
				<h-form-item label="业务类型" prop="type" required>
					<h-input v-model="formItem.type" placeholder="请输入" :disabled="isSubmited"></h-input>
				</h-form-item>
				<h-form-item label="待办标题" prop="title" required>
					<h-input v-model="formItem.title" placeholder="请输入" :disabled="isSubmited"></h-input>
				</h-form-item>
				<h-form-item label="内容描述" prop="mark" required>
					<h-input type="textarea" v-model="formItem.mark" placeholder="请输入" :rows="2" :disabled="isSubmited"></h-input>
				</h-form-item>
				<h-form-item label="会话附件" prop="session" required>
					<h-input v-model="formItem.session" placeholder="请输入" :disabled="isSubmited"></h-input>
				</h-form-item>
				<h-form-item label="关联客户" prop="client" required>
					<h-input v-model="formItem.client" placeholder="请输入" :disabled="isSubmited"></h-input>
				</h-form-item>
				<h-form-item label="截止日期" prop="modify_date" required>
					<h-date-picker v-model="formItem.modify_date"  type="date" placeholder="请选择" :disabled="isSubmited"></h-date-picker>
				</h-form-item>
			</h-form>
			<div v-if="!isSubmited" class="bottom-ope">
				<h-button type="info" @click="submit">提交待办</h-button>
			</div>
		</div>
	</div>
</template>

<script>
import ChatgptItemHeader from './chatgpt-item-header'
import { mapState, mapMutations } from "vuex"
export default {
	name: 'OrdinaryTaskCreate',
	props: {
		item: Object
	},
	components: {
		ChatgptItemHeader
	},
	data() {
		return {
			formItem: {
				type: '',
				title: '',
				mark: '',
				session: '',
				client: '',
				modify_date: ''
			},
			isSubmited: false, // 是否已提交
		}
	},
	computed: {
		
	},
	methods: {
		// 提交
		submit() {
			this.$refs.form.validate(valid => {
				if (valid) {
					this.isSubmited = true
					this.$public.message(this, 'success', '提交成功')
				} else {
					this.$public.message(this, 'error', '请填写完整信息')
				}
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.chatgpt-item-content{
	/deep/ .h-form-item-label{
		font-size: 14px;
		font-weight: bold;
		&::before{
			display: none;
		}
	}
	.bottom-ope{
		text-align: right;
		margin-top: 10px;
	}
}
</style>